from django import template
from apps.course.models import Course
from django.template.loader import render_to_string

register = template.Library()

def get_course_menu(parser, token):
    return CourseMenuNode()
    
class CourseMenuNode(template.Node):
    def render(self, context):
	Courses = Course.objects.exclude(course_id='__default')
	if not Courses: Courses = None
        context['course_menu'] = render_to_string('course/course_link.html',{'Courses':Courses},context)
        return ''

register.tag('get_course_menu', get_course_menu)
